
package controller;




import bo.BUS_HoaDon;
import com.opensymphony.xwork2.ActionSupport;
import dto.DTO_HoaDon;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;


public class CapNhatHDAction extends ActionSupport implements ServletRequestAware {

    private String NgayGiaoHang;
    private String DiaChiGiaoHang;
    private int TrangThai;
    private HttpServletRequest request;
    public String getDiaChiGiaoHang() {
        return DiaChiGiaoHang;
    }

    public void setDiaChiGiaoHang(String DiaChiGiaoHang) {
        this.DiaChiGiaoHang = DiaChiGiaoHang;
    }

    public String getNgayGiaoHang() {
        return NgayGiaoHang;
    }

    public void setNgayGiaoHang(String NgayGiaoHang) {
        this.NgayGiaoHang = NgayGiaoHang;
    }

    public int getTrangThai() {
        return TrangThai;
    }

    public void setTrangThai(int TrangThai) {
        this.TrangThai = TrangThai;
    }

    

    public CapNhatHDAction() {

    }



    public String execute() throws Exception {

        DTO_HoaDon hd = new DTO_HoaDon();
        int MaHD = Integer.parseInt(request.getParameter("MaHD"));
        hd.setMaHD(MaHD);
        hd.setNgayGiaoHang(NgayGiaoHang);
        hd.setDiachiGiaoHang(DiaChiGiaoHang);
        hd.setTrangThai(TrangThai);

        BUS_HoaDon busHD = new BUS_HoaDon();
        boolean flag = busHD.CapNhatHD(hd);
        if(flag == true)
        {
            return "success";
        }
        return "fail";

    }

    @Override
    public void setServletRequest(HttpServletRequest hsr) {
        request = hsr;
    }



}